package com.abc.controller;

import com.abc.entity.User;
import com.abc.entity.Xueshengjiaoshi;
import com.abc.service.XueshengJiaoshiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
public class XueshengJiaoshiController {
    @Autowired
    private XueshengJiaoshiService xueshengJiaoshiService;
    @RequestMapping(value = "/addXueshengjiaoshi")
    @ResponseBody
    public String addXueshengjiaoshi(Xueshengjiaoshi xueshengjiaoshi){
        return xueshengJiaoshiService.addXueshengjiaoshi(xueshengjiaoshi);
    }
    @RequestMapping(value = "/findAllXueshengjiaoshi")
    @ResponseBody
    public List<Map<String,String>> findAllXueshengjiaoshi(){
        return xueshengJiaoshiService.findAllXueshengjiaoshi();
    }

    @RequestMapping(value = "/findAllXueshengjiaoshiByJiaoshiid")
    @ResponseBody
    public List<Map<String,Object>> findAllXueshengjiaoshiByJiaoshiid(HttpServletRequest request){
        User user = (User)request.getSession().getAttribute("user");
        return xueshengJiaoshiService.findAllXueshengjiaoshiByJiaoshiid(user.getId()+"");
    }
    @RequestMapping(value = "/findAllXueshengjiaoshiXSByJiaoshiid")
    @ResponseBody
    public List<Map<String,Object>> findAllXueshengjiaoshiXSByJiaoshiid(HttpServletRequest request){
        User user = (User)request.getSession().getAttribute("user");
        return xueshengJiaoshiService.findAllXueshengjiaoshiXSByJiaoshiid(user.getId()+"");
    }



}
